package testing.comparer;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;

import words.Noun;
import words.NumberStat;

import comparer.NounComparer;
import comparer.NumberComparer;


public class NumberComparerTest {
	NumberComparer comparer;
	NumberStat origin_num;
	NumberStat compared_num;
	@Before
	public void setUp() throws Exception {
		this.comparer = new NumberComparer();
		this.origin_num = new NumberStat();
		this.compared_num = new NumberStat();
	}
	@Test
	public void test1()
	{
		String origin = "1000";
		String compare = "1000";
		origin_num.input(origin);
		compared_num.input(compare);
		comparer.set_origin(origin_num);
		comparer.set_compared(compared_num);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,1);
	}
	@Test
	public void test2()
	{
		String origin = "1000";
		String compare = "2000";
		origin_num.input(origin);
		compared_num.input(compare);
		comparer.set_origin(origin_num);
		comparer.set_compared(compared_num);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,0);
	}
	@Test
	public void test3()
	{
		String origin = "1000";
		String origin2 = "2500";
		String compare = "1000";
		String compare2 = "2500";
		origin_num.input(origin);
		origin_num.input(origin2);
		compared_num.input(compare);
		compared_num.input(compare2);
		comparer.set_origin(origin_num);
		comparer.set_compared(compared_num);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,2);
	}
	@Test
	public void test4()
	{
		String origin = "1000";
		String origin2 = "2500";
		String compare = "1000";
		String compare2 = "3500";
		origin_num.input(origin);
		origin_num.input(origin2);
		compared_num.input(compare);
		compared_num.input(compare2);
		comparer.set_origin(origin_num);
		comparer.set_compared(compared_num);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,1);
	}
	@Test
	public void test5()
	{
		String origin = "1000";
		String origin2 = "2500";
		String compare = "1400";
		String compare2 = "3500";
		origin_num.input(origin);
		origin_num.input(origin2);
		compared_num.input(compare);
		compared_num.input(compare2);
		comparer.set_origin(origin_num);
		comparer.set_compared(compared_num);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,0);
	}
}
